package org.rednebula.framework.core.service;

import javax.servlet.http.HttpSession;

import org.rednebula.framework.core.IEnvironment;
import org.rednebula.framework.core.model.domain.IModel;
import org.springframework.stereotype.Component;

@Component
public class DefaultCoreCacheService implements ICacheService {

	public void cache(Object key, IModel model, IEnvironment env) {
		HttpSession session=ServiceFacade.getHttpSession(env);
		session.setAttribute((String)key, model);
	}

	public IModel getModel(Object key, IEnvironment env) {
		HttpSession session=ServiceFacade.getHttpSession(env);
		return (IModel)session.getAttribute((String)key);
	}

}
